package ar.com.personalTravellers.generators;

import java.io.Serializable;
import java.util.Collection;

import com.angel.architecture.constants.ArchitectureDAOsNames;
import com.angel.architecture.flex.locator.ObjectLocator;
import com.angel.architecture.persistence.beans.Role;
import com.angel.dao.generic.factory.DAOFactory;
import com.angel.dao.generic.interfaces.GenericDAO;
import com.angel.data.generator.interfaces.DataGenerator;

/**
 *
 * @author William
 */
public class RoleDataGenerator implements DataGenerator {
    /**
	 *
	 */
	private static final long serialVersionUID = 1570123667875640283L;

	@SuppressWarnings("unchecked")
	public Class<? extends DataGenerator>[] getDependecesGenerators() {
        return (Class<? extends DataGenerator>[]) new Class[]{};
    }

    public void generateData(Collection<Object> objects, DAOFactory daoFactory) {

        Role admin = new Role();
        admin.setName("Admin");
        admin.setDescription("Application Admin.");
        objects.add(admin);

        Role guest = new Role();
        guest.setName("Guest");
        guest.setDescription("Guest");
        objects.add(guest);
    }

    public Class<? extends Object> getDataGeneratorClass() {
        return Role.class;
    }

    @SuppressWarnings("unchecked")
	public GenericDAO<Object, Serializable> getGenericDAO() {
        return (GenericDAO<Object, Serializable>) ObjectLocator.getBeanByName(ArchitectureDAOsNames.ROLE_DAO_NAME);
    }

	public Class<?> thisDataGeneratorClass() {
		return this.getClass();
	}
}